<template>
  <!-- eslint-disable vue/require-component-is -->
  <div class="portal-editor-container">
    <el-row
      v-for="(row, rowIndex) in dragReportData.children"
      :key="rowIndex"
      :gutter="10"
      :style="{margin:'0 0 10px 0'}"
    >
      <el-col v-for="(col, colIndex) in row.children" :key="colIndex" :md="col.initCol">
        <div style="background:#fff;border:1px solid #ccc;">
          <div class="title">{{ col.name }}</div>
          <el-scrollbar
            :style="previewColStyle({width: 24, height: row.initHeight, baseHeight: 1})"
          >
            <component
              :is="col.code"
              :key="colIndex"
              :dialog-visible.sync="col.dialogVisible"
              :config="col.paramList"
            />
          </el-scrollbar>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import colStyle from './mixins/methods/col-style'
import portletList from './portletList'
export default {
  name: 'portal-preview',
  components: { ...portletList },
  mixins: [colStyle],
  props: {
    dragReportData: {
      type: Object,
      default: () => {
        return {
          title: '',
          children: []
        }
      }
    }
  }
}
</script>
<style lang="scss" >
.portal-editor-container {
  .el-scrollbar__wrap {
    overflow-x: hidden;
    padding: 10px;
  }
}
</style>

<style lang="scss" scoped>
.portal-editor-container {
  padding: 16px;
  background-color: rgb(240, 242, 245);
  position: relative;
  .github-corner {
    position: absolute;
    top: 0px;
    border: 0;
    right: 0;
  }

  .title {
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.05) 0%,
      rgba(0, 0, 0, 0.1) 30%,
      rgba(0, 0, 0, 0.15) 50%,
      rgba(0, 0, 0, 0.1) 80%,
      rgba(0, 0, 0, 0.05) 100%
    );
    height: 30px;
    line-height: 30px;
    padding-left: 10px;
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
</style>
